
package com.hlkj.pay.controller.api;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.hlkj.framework.common.pojo.CommonResult;
import com.hlkj.pay.app.order.IPayOrderAppService;
import com.hlkj.pay.vo.order.req.PreOrderPayReq;
import com.hlkj.pay.vo.order.resp.PayOrderResp;
import com.hlkj.pay.vo.order.resp.PrePayOrderResp;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author HlpayTeam
 * @date 2024/10/09 11:25
 */
@Tag(name = "订单管理")
@RestController
@RequestMapping("/api/pay/order")
@RequiredArgsConstructor
@Slf4j
public class ApiOrderPayController {

    private final IPayOrderAppService payOrderAppService;

    @Operation(summary = "预订单提交订单")
    @PostMapping("/create")
    CommonResult<PayOrderResp> preSubmitOrder(@Validated @RequestBody PreOrderPayReq preOrderPayReq) {
        return payOrderAppService.preSubmitOrder(preOrderPayReq);
    }

    @Operation(summary = "AUT订单查询")
    @GetMapping("/query")
    CommonResult<PrePayOrderResp> queryOrder(@RequestParam("payOrderNo") String payOrderNo) {
        return payOrderAppService.queryOrder(payOrderNo);
    }

}
